var mBool = false;
chrome.webRequest.onHeadersReceived.addListener(function (details) {
    if(details.url.indexOf('https://kyfw.12306.cn/otn/leftTicket/queryE') !== -1){
        if(mBool){
            chrome.tabs.query({active:true,currentWindow:true},function(tabs){
                chrome.tabs.sendMessage(tabs[0].id,{name:'list',content:details.url});
            });
        }
    }
    return {responseHeaders: details.responseHeaders};
}, {
    urls: [
        "<all_urls>",
    ]
}, ['responseHeaders']
);

chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
    if(message.name == 'load'){
        mBool = true;
    }
});